package cn.fzkj.project.monitor.domain;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonAlias;
import org.springframework.boot.autoconfigure.info.ProjectInfoProperties;

import java.util.Date;

/** 操作日志表. */
@TableName("fzkj_system_log")
public class SystemLog {

    @TableId(type = IdType.ASSIGN_ID, value = "sys_id")
    private Long sysId;
    /** 操作者. */
    @TableField(value = "sys_user_name")
    private String sysUserName;
    /** 操作者身份. */
    @TableField(value = "sys_user_type")
    private Integer sysUserType;
    /** 操作时间. */
    @JsonAlias("sysOprateTime")  // 操作时间
    @TableField(value = "gmt_create", fill = FieldFill.INSERT)
    private Date gmtCreate;
    /** 请求的路径. */
    @TableField(value = "sys_url")
    private String sysUrl;
    /** 请求的地址. */
    @TableField(value = "sys_addr")
    private String sysAddr;
    /** 请求的主机. */
    @TableField(value = "sys_host")
    private String sysHost;
    /** 请求的远端用户. */
    @TableField(value = "sys_remote_user")
    private String sysRemoteUser;
    /** 操作系统信息. */
    @TableField(value = "sys_system_info")
    private String sysSystemInfo;
    /** 浏览器信息. */
    @TableField(value = "sys_browser_info")
    private String sysBrowserInfo;
    /** mac地址. */
    @TableField(value = "sys_mac")
    private String sysMac;
    SystemLog(){}
    SystemLog(Builder builder){
        this.gmtCreate=builder.gmtCreate;
        this.sysAddr=builder.sysAddr;
        this.sysBrowserInfo=builder.sysBrowserInfo;
        this.sysHost=builder.sysHost;
        this.sysId=builder.sysId;
        this.sysRemoteUser=builder.sysRemoteUser;
        this.sysSystemInfo=builder.sysSystemInfo;
        this.sysUrl=builder.sysUrl;
        this.sysUserName=builder.sysUserName;
        this.sysUserType=builder.sysUserType;
        this.sysMac = builder.sysMac;
    }

    public static class Builder{
        private Long sysId;
        private String sysUserName;
        private Integer sysUserType;
        private Date gmtCreate;
        private String sysUrl;
        private String sysAddr;
        private String sysHost;
        private String sysRemoteUser;
        private String sysSystemInfo;
        private String sysBrowserInfo;
        private String sysMac;

        public Builder(){}

        public Builder setSysUserName(String sysUserName){
            this.sysUserName = sysUserName;
            return this;
        }
        public Builder setSysUserType(Integer sysUserType){
            this.sysUserType = sysUserType;
            return this;
        }
        public Builder setSysUrl(String url){
            this.sysUrl = url;
            return this;
        }
        public Builder setSysAddr(String sysAddr){
            this.sysAddr = sysAddr;
            return this;
        }
        public Builder setSysHost(String sysHost){
            this.sysHost = sysHost;
            return this;
        }
        public Builder setSysRemoteUser(String remoteUser){
            this.sysRemoteUser = remoteUser;
            return this;
        }
        public Builder setSystemInfo(String systemInfo){
            this.sysSystemInfo = systemInfo;
            return this;
        }
        public Builder setBrowserInfo(String browserInfo){
            this.sysBrowserInfo = browserInfo;
            return this;
        }
        public Builder setSysMac(String sysMac){
            this.sysMac = sysMac;
            return this;
        }
        public SystemLog build(){
            return new SystemLog(this);
        }
    }

}
